using System;
using System.ComponentModel;

namespace ebcpatterns.rx
{
    public class StreamedPropertyChangedEventArgs : PropertyChangedEventArgs
    {
        internal StreamedPropertyChangedEventArgs(object sender, PropertyChangedEventArgs args) : base(args.PropertyName)
        {
            this.Sender = sender;
        }

        public object Sender { get; private set; }
    }


    public class INotifyPropertyChangedToStream
    {
        public INotifyPropertyChangedToStream(){}
        public INotifyPropertyChangedToStream(INotifyPropertyChanged source)
        {
            source.PropertyChanged += this.Process;
        }


        public void Process(object sender, PropertyChangedEventArgs args)
        {
            this.PropertyChanged(new StreamedPropertyChangedEventArgs(sender, args));
        }


        public event Action<StreamedPropertyChangedEventArgs> PropertyChanged;
    }
}